﻿
namespace Codemonk.Pease.Common
{
    /// <summary>
    /// 序列化器
    /// </summary>
    /// <typeparam name="T">序列化的目标类型</typeparam>
    public interface ISerializater<T>
    {
        /// <summary>
        /// 将对象序列化为目标类型
        /// </summary>
        /// <param name="obj">需要序列化的对象</param>
        /// <returns>序列化的结果</returns>
        T Serialize(object obj);
        /// <summary>
        /// 反序列化数据
        /// </summary>
        /// <param name="data">需要反序列化的数据</param>
        /// <typeparam name="B">返回的类型</typeparam>
        /// <returns>反序列化结果</returns>
        B Deserialize<B>(T data);
    }
}
